package day10;

import java.util.Scanner;

/**
 * 对给定的一个字符串，找出有重复的字符，
 * 并给出其位置，如：abcaaAB12ab12
 * 输出：a，1；a，4；a，5；a，10，
 * b，2；b，11，
 * 1，8；1，12，
 * 2，9；2，13。
 * Created by Administrator on 2017/1/9.
 */
public class Test02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String str = sc.next();
            char[] chs = str.toCharArray();
            int[] ints = new int[chs.length];
            for (int i = 0; i < chs.length; i++) {
                if (ints[i] != 0) {
                    continue;
                }
                char ch = chs[i];
                ints[i] = 1;
                String line = ch + ":" + i;
                boolean flag = false;
                for (int j = i + 1; j < chs.length; j++) {
                    if (ch == chs[j]) {
                        line = line + "," + ch + ":" + j;
                        flag = true;
                        ints[j] = 1;
                    }
                }
                if (flag) {
                    System.out.println(line);
                }
            }
        }
    }
}
